def is_prime(num):
    if num < 2:
        return False
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            return False
    return True

def nearest_prime(num):
    while not is_prime(num):
        num += 1
    return num

words = input().split()
word_to_num = {
    "zero": "0",
    "one": "1",
    "two": "2",
    "three": "3",
    "four": "4",
    "five": "5",
    "six": "6",
    "seven": "7",
    "eight": "8",
    "nine": "9"
}

try:
    num = int("".join([word_to_num[word] for word in words]))
    if 100 <= num <= 999:
        result = nearest_prime(num)
        print(result)
    else:
        print("Wrong input")
except:
    print("Wrong input")
